package com.kfm.base.array;

import java.util.Random;
import java.util.Scanner;

public class Demo03 {


    public static void main(String[] args) {
        Random rand = new Random();

        // [0, 100)
        int num = rand.nextInt(100);

        Scanner in = new Scanner(System.in);

        for(int i = 0; i < 7; i ++){
            System.out.println("请输入您猜的数字：");
            int a = in.nextInt();
            if (a == num){
                System.out.println("恭喜您，猜对了");
                break;
            } else if (a > num) {
                System.out.println("大了");
            } else {
                System.out.println("小了");
            }
        }
    }
}
